import { DressUpData } from "../data/DressUpData";
import { ItemLogicBase } from "../../logicItem/ItemLogicBase";
import { GameTool } from "../../tool/GameTool";


export class LotteryAwardItemLogic extends ItemLogicBase {


    private bgImg:Laya.Image;
    private iconImg:Laya.Image; 
    private nameLab:Laya.Label; 
    constructor(box: Laya.Sprite){
        super(box);
    }
    initNode(box: Laya.Box): void {
        this.bgImg = box.getChildByName("bgImg") as Laya.Image;
        this.iconImg = this.bgImg.getChildByName("iconImg") as Laya.Image;
        this.nameLab = box.getChildByName("nameLab") as Laya.Label;
    }

    initUi(data: any[]) {
        this.data = data;
        
        let goodsData :any = this.data[0];
        
        // if(goodsData.color && goodsData.color.length){
        //     GameTool.createCricleColor(this.iconImg.width, goodsData.color, this.iconImg);
        // }else{

        // }
        GameTool.setSkin(goodsData.goods_icon_url, this.iconImg, true);
        this.nameLab.text = goodsData.goods_name;
        // this.imgsp.skin = "comp/image.png";
        
    }


    clear(): void {
        this.iconImg = null;
        this.bgImg = null;
        this.nameLab = null;
        this.box = null;
        this.data = null;
    }
}